package com.yict.csms.baseInfo.entity;

import java.util.Date;
import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.yict.csms.company.entity.Contract;
import com.yict.csms.system.entity.User;

/**
 * 合同类别表Entity
 * 
 * @author Patrick.Deng
 * 
 */
@Entity
@Table(name = "CSMS_CONTRACT_TYPE")
public class ContractType {

	@Id
	@Column(name = "TYPEID")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "csms_contractType_seq")
	@SequenceGenerator(name = "csms_contractType_seq", sequenceName = "SEQ_CSMS_CONTRACT_TYPE", allocationSize = 1, initialValue = 1)
	private Long typeId;

	@Column(name = "TYPECODE")
	private String typeCode;

	@Column(name = "TYPENAME")
	private String typeName;

	@Column(name = "CREATEDATE")
	private Date createDate;

	@Column(name = "UPDATEDATE")
	private Date updateDate;

	/*@ManyToOne
	@JoinColumn(name = "CREATEPERSON")
	private User createPerson;

	@ManyToOne
	@JoinColumn(name = "UPDATEPERSON")
	private User updatePerson;*/

	@Column(name = "CREATEPERSON")
	private Long createPerson;

	@Column(name = "UPDATEPERSON")
	private Long updatePerson;
	
	@OneToMany(fetch=FetchType.LAZY)
	@JoinColumn(name = "TYPEID")
	private Set<Contract> contractSet = new LinkedHashSet<Contract>();

	public Long getTypeId() {
		return typeId;
	}

	public void setTypeId(Long typeId) {
		this.typeId = typeId;
	}

	public String getTypeCode() {
		return typeCode;
	}

	public void setTypeCode(String typeCode) {
		this.typeCode = typeCode;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	/*public User getCreatePerson() {
		return createPerson;
	}

	public void setCreatePerson(User createPerson) {
		this.createPerson = createPerson;
	}

	public User getUpdatePerson() {
		return updatePerson;
	}

	public void setUpdatePerson(User updatePerson) {
		this.updatePerson = updatePerson;
	}*/

	public Set<Contract> getContractSet() {
		return contractSet;
	}

	public void setContractSet(Set<Contract> contractSet) {
		this.contractSet = contractSet;
	}

	public Long getCreatePerson() {
		return createPerson;
	}

	public void setCreatePerson(Long createPerson) {
		this.createPerson = createPerson;
	}

	public Long getUpdatePerson() {
		return updatePerson;
	}

	public void setUpdatePerson(Long updatePerson) {
		this.updatePerson = updatePerson;
	}
}
